#ifndef __DISPLAY_H__
#define __DISPLAY_H__
#include "stdint.h"
#include "stdio.h"
#include "video_base.h"
#include "libmaix_disp.h"
#include "libmaix_image.h"

class IVidRender
{
private:

public:
    IVidRender(){};
    virtual ~IVidRender(){};
    virtual int32_t Start(int32_t id, int32_t w, int32_t h) = 0;
    virtual int32_t Deliver(struct MemoryFrame *frame) = 0;
    virtual int32_t Stop() = 0;
};

class AWRender : public IVidRender
{
private:
    int32_t _width;
    int32_t _height;
    int32_t _ratio_height;
    libmaix_disp *_disp_inst;
    libmaix_image *_image_yuv_inst;
    libmaix_image *_image_rgb_inst;
    libmaix_image *_image_disp_inst;
    bool _isStarted;


public:
    AWRender();
    virtual ~AWRender();

    virtual int32_t Start(int32_t id, int32_t w, int32_t h);
    virtual int32_t Deliver(struct MemoryFrame *frame);
    virtual int32_t Stop();
};


#ifdef __cplusplus
extern "C" {
#endif

typedef void *AW_VID_RENDER_HANDLE;


typedef struct aw_vid_render_instance {
    int32_t width;
    int32_t height;
    IVidRender *IVidRend;
}vid_render_ins;

int32_t aw_vid_render_init( int32_t width, int32_t height, /*out*/AW_VID_RENDER_HANDLE *handle );
int32_t aw_vid_render_deinit( /*in*/AW_VID_RENDER_HANDLE handle );

int32_t aw_vid_render_start( /*in*/AW_VID_RENDER_HANDLE handle );
int32_t aw_vid_render_stop( /*in*/AW_VID_RENDER_HANDLE handle );

int32_t aw_vid_render_deliver( /*in*/AW_VID_RENDER_HANDLE handle, struct MemoryFrame *frame );


#ifdef __cplusplus
}
#endif




#endif